module.exports = (option, app) => {
    return async function auth(ctx, next) {
        /* 实现中间件 */
        const url = ctx.path;
        if (url == '/api/goods' || url == '/api/login') {
            await next();
        }else{
            if(ctx.cookies.get('username')){
                await next()
            }else{
                ctx.body={
                    code:400,
                    msg:'未登录请先登录'
                }
            }
        }

    }
}